const fs = require("fs");
const url = require("url");
function static(path){
    return function(req, res, next){
        let urlObj = url.parse(req.url);
        fs.readFile(path + urlObj.pathname,(err,data)=>{
            if(err){
                next();
            }else{
                res.write(data);
                res.end();
            }
        })
    }
}
exports.static = static;